package com.fulin.leetcode;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * TODO
 *
 * @Author fulin
 * @Date 2023/2/20 19:51
 **/
public class Num2347_最好的扑克手牌 {
    public String bestHand(int[] ranks, char[] suits) {
        Set<Character> set = new HashSet<>();
        for (int i = 0; i < suits.length; i++) {
            set.add(suits[i]);
        }
        if(set.size() == 1){
            return "Flush";
        }

        Map<Integer,Integer> map = new HashMap<>();
        for (int rank : ranks) {
            map.put(rank,map.getOrDefault(rank,0) + 1);
        }

        if(map.size() == 5){
            return "High Card";
        }

        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if(entry.getValue() > 2){
                return "Three of a Kind";
            }
        }
        return "Pair";
    }


}
